<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        div {
            color: rebeccapurple;
        }
    </style>

</head>

<body>
    <div>测试 </div>
    <script>
        //修改dom样式
        // 设置的行内样式
        var div = document.querySelector('div');
        //所有学的css属性都可以设置
        div.style.color = 'red';
        // 如果css属性有多个单词组成，js中修改为 驼峰法则
        div.style.backgroundColor = 'green';

    </script>

</body>

</html>